const cache = {
	set(data) {
		return uni.setStorageSync(this.key, JSON.stringify(data))
	},
	get() {
		try {
			let dt = uni.getStorageSync(this.key)
			return dt ? JSON.parse(dt) : []
		} catch {
			return {}
		}
	},
	del() {
		return uni.removeStorageSync(this.key)
	}
}

// 购物车
export const shopCart = {
	key: 'SHOP_CART_CACHE',
	...cache
}

//订单
export const userOrder = {
	key: 'USER_ORDER_CACHE',
	...cache
}
//历史
export const searchHistory = {
	key: 'USER_SEARCH_HISTORY',
	...cache
}

//足迹
export const viewHistory = {
	key: 'USER_VIEW_HISTORY',
	...cache
}